/* 图表专用样式 */

/* 图表容器基础样式 */
.chart-container {
    position: relative;
    width: 100%;
    min-height: 300px;
    margin: 0 auto;
}

.chart-container.small {
    min-height: 200px;
}

.chart-container.large {
    min-height: 400px;
}

.chart-container.x-large {
    min-height: 500px;
}

/* 图表包装器 */
.chart-wrapper {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
}

.chart-wrapper:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* 图表头部 */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f8f9fa;
}

.chart-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chart-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
}

.chart-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 图表控制按钮 */
.chart-control-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: white;
    color: #6c757d;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chart-control-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.chart-control-btn.active {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
}

/* 图表图例 */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #495057;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-label {
    font-weight: 500;
}

/* 图表工具栏 */
.chart-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

/* 图表过滤器 */
.chart-filter {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: white;
    font-size: 13px;
    cursor: pointer;
}

/* 图表加载状态 */
.chart-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    z-index: 10;
}

.chart-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 图表错误状态 */
.chart-error {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(220, 53, 69, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #dc3545;
    padding: 20px;
    text-align: center;
}

.chart-error-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.chart-error-message {
    font-size: 16px;
    font-weight: 500;
}

/* 实时更新指示器 */
.realtime-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    background-color: #d4edda;
    color: #155724;
}

.realtime-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #28a745;
    animation: pulse 2s infinite;
}

/* 图表提示框样式增强 */
.chart-tooltip {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    z-index: 100;
    max-width: 300px;
}

.chart-tooltip-header {
    font-weight: 600;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.chart-tooltip-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.chart-tooltip-item:last-child {
    margin-bottom: 0;
}

.chart-tooltip-label {
    opacity: 0.8;
}

.chart-tooltip-value {
    font-weight: 600;
}

.chart-tooltip-color {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    margin-right: 8px;
}

/* 多图表网格布局 */
.multi-chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.multi-chart-grid.col-2 {
    grid-template-columns: repeat(2, 1fr);
}

.multi-chart-grid.col-3 {
    grid-template-columns: repeat(3, 1fr);
}

.multi-chart-grid.col-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* 图表容器变体 */
.chart-container.full-width {
    grid-column: 1 / -1;
}

.chart-container.span-2 {
    grid-column: span 2;
}

/* 动态更新动画 */
@keyframes chart-update {
    0% {
        opacity: 0.6;
        transform: scale(0.98);
    }
    50% {
        opacity: 1;
        transform: scale(1.02);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.chart-updating {
    animation: chart-update 0.5s ease;
}

/* 数据点样式 */
.chart-data-point {
    transition: all 0.3s ease;
    cursor: pointer;
}

.chart-data-point:hover {
    transform: scale(1.2);
    filter: brightness(1.2);
}

/* 图表区域样式 */
.chart-area {
    fill: url(#colorGradient);
    opacity: 0.3;
}

/* 图表渐变定义 */
.chart-gradient {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* 轴线样式 */
.chart-axis {
    stroke: #e9ecef;
    stroke-width: 1px;
}

.chart-axis-tick {
    stroke: #adb5bd;
    stroke-width: 1px;
}

.chart-axis-label {
    font-size: 12px;
    fill: #6c757d;
}

/* 滚动图表容器 */
.scrolling-chart-container {
    position: relative;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 20px;
}

.scrolling-chart-wrapper {
    min-width: 800px;
}

/* 图表缩放控件 */
.chart-zoom-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background-color: white;
    padding: 8px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 20;
}

.zoom-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 4px;
    background-color: #f8f9fa;
    color: #495057;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
}

.zoom-btn:hover {
    background-color: #667eea;
    color: white;
}

/* 图表时间范围滑块 */
.chart-time-range {
    margin-top: 20px;
    padding: 16px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.time-range-slider {
    width: 100%;
    margin: 10px 0;
}

.time-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #6c757d;
}

/* 雷达图专用样式 */
.radar-chart-container {
    position: relative;
    width: 100%;
    height: 400px;
}

.radar-axis {
    stroke: #e9ecef;
    stroke-width: 1px;
}

.radar-grid {
    stroke: #dee2e6;
    stroke-width: 1px;
}

.radar-area {
    fill-opacity: 0.2;
    stroke-width: 2px;
}

/* 极坐标图专用样式 */
.polar-chart-container {
    position: relative;
    width: 100%;
    height: 400px;
}

/* 热力图专用样式 */
.heatmap-container {
    position: relative;
    width: 100%;
    overflow-x: auto;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px;
}

.heatmap-label {
    padding: 8px;
    background-color: #f8f9fa;
    text-align: right;
    font-size: 12px;
    color: #6c757d;
    border-radius: 4px;
}

.heatmap-cell {
    border-radius: 4px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.heatmap-cell:hover {
    transform: scale(1.1);
    z-index: 10;
}

/* 仪表盘样式 */
.gauge-container {
    position: relative;
    width: 100%;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gauge-value {
    position: absolute;
    font-size: 32px;
    font-weight: 700;
    color: #2c3e50;
}

.gauge-label {
    position: absolute;
    bottom: 20px;
    font-size: 14px;
    color: #6c757d;
}

/* 散点图样式 */
.scatter-chart-container {
    position: relative;
    width: 100%;
    height: 400px;
}

.scatter-point {
    cursor: pointer;
    transition: all 0.3s ease;
}

.scatter-point:hover {
    transform: scale(1.5);
    z-index: 10;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .multi-chart-grid.col-4 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .chart-container.span-2 {
        grid-column: span 3;
    }
}

@media (max-width: 992px) {
    .multi-chart-grid.col-3,
    .multi-chart-grid.col-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chart-container.span-2 {
        grid-column: span 2;
    }
    
    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .chart-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .chart-wrapper {
        padding: 16px;
    }
    
    .multi-chart-grid,
    .multi-chart-grid.col-2,
    .multi-chart-grid.col-3,
    .multi-chart-grid.col-4 {
        grid-template-columns: 1fr;
    }
    
    .chart-container,
    .chart-container.full-width,
    .chart-container.span-2 {
        grid-column: span 1;
    }
    
    .chart-container {
        min-height: 250px;
    }
    
    .chart-container.large {
        min-height: 300px;
    }
    
    .chart-title {
        font-size: 16px;
    }
    
    .chart-legend {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .chart-container {
        min-height: 200px;
    }
    
    .chart-actions {
        gap: 6px;
    }
    
    .chart-control-btn {
        font-size: 12px;
        padding: 4px 8px;
    }
    
    .legend-item {
        font-size: 12px;
    }
}